﻿using Futil;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace OKDebug
{
    public partial class FrmPostEx : Form
    {
        public List<Key> _HeaderList = new List<Key>();
        public string _ParamJSON = string.Empty;
        public FrmPostEx()
        {
            InitializeComponent();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if(!string.IsNullOrEmpty(txtHeader1NAME.Text.Trim()) && !string.IsNullOrEmpty(txtHeader1VALUE.Text.Trim()))
            {
                Key key = new Key();
                key.Name = txtHeader1NAME.Text.Trim();
                key.Code = txtHeader1VALUE.Text.Trim();
                _HeaderList.Add(key);
            }

            if (!string.IsNullOrEmpty(txtHeader2NAME.Text.Trim()) && !string.IsNullOrEmpty(txtHeader2VALUE.Text.Trim()))
            {
                Key key = new Key();
                key.Name = txtHeader2NAME.Text.Trim();
                key.Code = txtHeader2VALUE.Text.Trim();
                _HeaderList.Add(key);
            }

            if (!string.IsNullOrEmpty(txtHeader3NAME.Text.Trim()) && !string.IsNullOrEmpty(txtHeader3VALUE.Text.Trim()))
            {
                Key key = new Key();
                key.Name = txtHeader3NAME.Text.Trim();
                key.Code = txtHeader3VALUE.Text.Trim();
                _HeaderList.Add(key);
            }

            this._ParamJSON = this.txtWebapiIN.Text.Trim();
            this.DialogResult = DialogResult.OK;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void FrmPostEx_Load(object sender, EventArgs e)
        {
            this.txtWebapiIN.Text = _ParamJSON;
        }
    }
}
